package com.zoo.diannaopeijian.controller.export;

import com.zoo.diannaopeijian.comm.page.Page;
import com.zoo.diannaopeijian.controller.BaseController;
import com.zoo.diannaopeijian.domain.ExportChannel;
import com.zoo.diannaopeijian.service.ExportChannelService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by zx583 on 2018-01-28.
 */
@Controller
@RequestMapping("/exportChannel")
public class ExportChannelController extends BaseController {
    @Resource
    private ExportChannelService exportChannelService;

    @RequestMapping("/exportChannelManaPage")
    public String exportChannelManaPageRoute() {
        return "export/exportChannel/exportChannelManaPage";
    }

    @RequestMapping("/exportChannelAddPage")
    public String exportChannelAddPageRoute()  {
        return "export/exportChannel/exportChannelAddPage";
    }

    @RequestMapping("/exportChannelUpdatePage")
    public String exportChannelUpdatePageRoute()  {
        return "export/exportChannel/exportChannelUpdatePage";
    }

    @RequestMapping("/getAllExportChannel")
    @ResponseBody
    public Map getAllExportChannel(Page page) {
        return buildPageResult(exportChannelService.getAllExportChannel(page));
    }

    @RequestMapping("/getExportChannelList")
    @ResponseBody
    public List getExportChannelList() {
        return exportChannelService.getAllExportChannel(null);
    }

    @RequestMapping("/addExportChannel")
    @ResponseBody
    public String addExportChannel(ExportChannel exportChannel) {
        return exportChannelService.addExportChannel(exportChannel) ? success : fail;
    }

    @RequestMapping("/updateExportChannel")
    @ResponseBody
    public String updateExportChannel(ExportChannel exportChannel) {
        return exportChannelService.updateExportChannel(exportChannel) ? success : fail;
    }

    @RequestMapping("/deleteExportChannel")
    @ResponseBody
    public String deleteExportChannel(Integer exportchannelid) {
        return exportChannelService.deleteExportChannel(exportchannelid) ? success : fail;
    }
}
